package org.qydjk.console.service.impl;

import org.qydjk.common.pojo.seller.HospitalDepartment;
import org.qydjk.common.pojo.seller.HospitalKeyDepartment;
import org.qydjk.common.service.impl.BaseService;
import org.qydjk.console.service.IHospitalDeptService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HospitalDeptService extends BaseService implements IHospitalDeptService {

    /**
     * 删除基础科室
     * @param id
     * @throws Exception
     */
    public void delHospialDept(Integer id) throws Exception {
        String sql = "select * from qy_hospital_key_department where hospital_department_id = "+id;
        List<HospitalKeyDepartment> hospitalKeyDepartments = baseDao.findBeanBySQL(sql,HospitalKeyDepartment.class);
        if(hospitalKeyDepartments.size()>0){
            baseDao.deleteAll(hospitalKeyDepartments);
        }
        HospitalDepartment hospitalDepartment = baseDao.get(HospitalDepartment.class,id);
        baseDao.delete(hospitalDepartment);
    }
}
